<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:s="http://jboss.com/products/seam/taglib"
      >
      <body>
       <h:form>
        <a4j:include viewId="toolBar.xhtml"/>
        
         
           <rich:tabPanel>
                <rich:tab switchType="client" label="Security Settings">
                   <rich:panel style="width:100%">
                     <f:facet name="header">
                         Security Settings
                     </f:facet>
                     <table align="center" style="width:100%;font-size:12px">
                         <tr>
                             <td>Allowed number of failed loggin attempts</td>
                             <td><rich:inputNumberSpinner value="99"/></td>
                         </tr>
                         <tr>
                             <td>Password never expires</td>
                             <td><h:selectBooleanCheckbox value="true" /></td>
                         </tr>
                         <tr>
                             <td>Password validity period in days</td>
                             <td><rich:inputNumberSpinner value="99"/></td>
                         </tr>
                         <tr>
                             <td>Block account after defined period of inactivity</td>
                             <td><h:selectBooleanCheckbox value="false" /></td>
                         </tr>
                         <tr>
                             <td>Allowed account inactivity period in days</td>
                             <td><rich:inputNumberSpinner value="60"/></td>
                         </tr>
                         <tr>
                             <td>Number of stored old passwords</td>
                             <td><rich:inputNumberSpinner value="1"/></td>
                         </tr>
                         <tr>
                             <td>Password minimal length</td>
                             <td><rich:inputNumberSpinner value="1"/></td>
                         </tr>
                         <tr>
                             <td>Password should contain numbers and characters</td>
                             <td><h:selectBooleanCheckbox value="false" /></td> 
                         </tr>
                         <tr>
                             <td><a4j:commandButton value="Apply changes" style="width:120px"/></td>
                         </tr>
                     </table>
                     
                   </rich:panel>
               </rich:tab>
           
               <rich:tab switchType="client" label="System Properties">
                   <rich:datascroller  for="propertiesTable"/>
                   <rich:dataTable id="propertiesTable" value="#{propSession.allProperties}" var="pr" rows="10" style="width:100%">
                       <rich:column sortBy="#{pr.propKey}" style="text-align:center">
                           <f:facet name="header">
                               Property
                           </f:facet>
                           <h:outputText value="#{pr.propKey}"/>
                       </rich:column>
                       <rich:column sortBy="#{pr.value}" style="text-align:center">
                           <f:facet name="header">
                               #{messages['fina2.web.value']}
                           </f:facet>
                           <h:outputText value="#{pr.value}"/>
                       </rich:column>
                       <rich:column sortIcon="/images/edit.gif" style="text-align:center">
                           <f:facet name="header">
                               #{messages['fina2.amend']}
                           </f:facet>
                           <a4j:commandButton disabled="#{(pr.propKey=='fina2.mfb.xls.name.pattern' || pr.propKey=='fina2.mfb.uploaded.file.unique')}" action="#{propSession.setSelectedProperty(pr)}" oncomplete="Richfaces.showModalPanel('editPropertyPanel')" reRender="editProperty"  image="/images/edit.gif">
                            
                           </a4j:commandButton>
                       </rich:column>
                   </rich:dataTable>
               </rich:tab>
               
              
           </rich:tabPanel>
        
       </h:form>
       
        <rich:modalPanel id="editPropertyPanel" autosized="true" resizeable="false" width="300">
          <f:facet name="header">
              #{messages['fina2.amend']}
          </f:facet>
          <f:facet name="controls">
              <h:graphicImage value="/images/close.gif" onclick="Richfaces.hideModalPanel('editPropertyPanel')"/>
          </f:facet>
          <h:form>
              <f:facet name="beforeInvalidField">
                  <s:message style="font-size:12px;color:red"/>
              </f:facet>
              <f:facet name="aroundInvalidField">
              
              </f:facet>
              <f:facet name="afterInvalidField">
                  <s:div style="display:block;padding-bottom:12px"/>
              </f:facet>
              <s:div id="editProperty">
                  <h:outputFormat rendered="#{(propSession.selectedProperty.propKey!='fina2.sheet.protection.password')&amp;&amp;(propSession.selectedProperty.propKey!='fina2.xls.max.size')&amp;&amp;(propSession.selectedProperty.propKey!='fina2.zip.max.size')}" >
                  <table align="center" width="100%" style="font-size:12px">
                       <tr>
                          <td><rich:spacer width="12px" height="12px"/></td>
                       </tr>
                       <tr> 
                           
                           <td>Value</td>
                           <td><div style="color:red">*</div></td>
                           <td>
                               <s:decorate>
                                  <h:inputText value="#{propSession.selectedProperty.value}" validator="#{propValidator.validateValue}" required="true" requiredMessage="Value is required!" style="width:300px"/>
                               </s:decorate>
                           </td>
                           
                            </tr>
                          </table>
                          </h:outputFormat>
                          <h:outputFormat rendered="#{(propSession.selectedProperty.propKey=='fina2.xls.max.size')||(propSession.selectedProperty.propKey=='fina2.zip.max.size')}" >
                              <table align="center" width="100%" style="font-size:12px">
                                  <tr>
                                      <td>
                                          Value
                                      </td>
                                      <td>
                                          <div style="color:red">*</div>
                                      </td>
                                      <td>
                                          <s:decorate>
                                              <h:inputText value="#{propSession.selectedProperty.value}" validator="#{propValidator.validateMaxFilesValue}" required="true" requiredMessage="Value is required!" style="width:300px">
                                                 
                                              </h:inputText>
                                          </s:decorate>
                                      </td>
                                  </tr>
                              </table>
                          </h:outputFormat>
                          <h:outputFormat  rendered="#{propSession.selectedProperty.propKey=='fina2.sheet.protection.password'}">
                           <table align="center" width="100%" style="font-size:12px">
                              <tr>
                                   <td>
                                       <rich:spacer width="12px" height="12px"/>
                                   </td>
                              </tr>
                              <tr>
                                  <td>Password:</td>
                                  <td>
                                      <div style="color:red">*</div>
                                  </td>
                                  <td>
                                      <s:decorate>
                                          <h:inputSecret  value="#{propSession.selectedProperty.value}" validator="#{propValidator.validateValue}" required="true" requiredMessage="Value is required!" style="width:300px"/>
                                      </s:decorate>
                                  </td>
                               </tr>
                               <tr>
                                   <td>Confirm:</td>
                                   <td>
                                      <div style="color:red">*</div>
                                   </td>
                                   <td>
                                       <s:decorate>
                                           <h:inputSecret  value="#{propSession.confirmPassword}" validator="#{propValidator.validateConfirmValue}" required="true" requiredMessage="Confirm value is required!" style="width:300px"/>
                                       </s:decorate>
                                   </td>
                               </tr>
                           </table>
                           </h:outputFormat>
                  
                <rich:spacer height="3px"/>
                <table align="center" >
                   <tr>
                       <td><a4j:commandButton reRender="editProperty,propertiesTable" data="#{propSession.succes}"  action="#{propSession.updateProperty()}" value="Change" oncomplete="if(data)Richfaces.hideModalPanel('editPropertyPanel')" style="width:80px"/></td>
                       <td><rich:spacer width="3px"/></td>
                       <td><a4j:commandButton onclick="Richfaces.hideModalPanel('editPropertyPanel');return false;" value="#{messages['fina2.cancel']}" style="width:80px"/></td>
                   </tr>
                </table>
              </s:div>
          </h:form>
      </rich:modalPanel>
      </body>
</html>